import {getBaseCategoryList, getHomeBannerList, getFloorList} from "@/api/index";
// home模块
const state = {
    categoryList: [],
    homeBannerList: [],
    floorList: []
};
const mutations = {
    CATEGORY_LIST(state, value) {
        state.categoryList = value;
    },
    GET_BANNER_LIST(state, value) {
        state.homeBannerList = value;
    },
    GET_FLOOR_LIST(state, value) {
        state.floorList = value;
    }
};
const actions = {
    // 获取菜单数据
    async getBaseCategoryList(context, value) {
        let result = await getBaseCategoryList();
        if (result.code === 200) {
            context.commit("CATEGORY_LIST", result.data);
        }
    },
    async getBannerList(context, value) {
        let result = await getHomeBannerList();
        if (result.code === 200) {
            context.commit("GET_BANNER_LIST", result.data);
        }
    },
    async getFloorList(context, value) {
        let result = await getFloorList();
        if (result.code === 200) {
            context.commit("GET_FLOOR_LIST", result.data);
        }
    }
};
const getters = {};
export default {
    state,
    mutations,
    actions,
    getters
}